home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Columbia Kermit
/
kermit.zip
/
newsgroups
/
misc.20000114-20000217
/
000108_news@columbia.edu _Fri Jan 21 13:26:44 2000.msg
< prev
next >
Wrap
Internet Message Format
|
2020-01-01
|
5KB
Return-Path: <news@columbia.edu>
Received: from newsmaster.cc.columbia.edu (newsmaster.cc.columbia.edu [128.59.59.30])
by watsun.cc.columbia.edu (8.8.5/8.8.5) with ESMTP id NAA26675
for <kermit.misc@watsun.cc.columbia.edu>; Fri, 21 Jan 2000 13:26:44 -0500 (EST)
Received: (from news@localhost)
by newsmaster.cc.columbia.edu (8.8.5/8.8.5) id NAA24730
for kermit.misc@watsun.cc.columbia.edu; Fri, 21 Jan 2000 13:09:02 -0500 (EST)
X-Authentication-Warning: newsmaster.cc.columbia.edu: news set sender to <news> using -f
From: fdc@watsun.cc.columbia.edu (Frank da Cruz)
Subject: Case Study #13: PPP Dialing
Date: 21 Jan 2000 18:09:01 GMT
Organization: Columbia University
Message-ID: <86a7bt$o4o$1@newsmaster.cc.columbia.edu>
To: kermit.misc@columbia.edu
Reminder: These case studies and tutorials are also available
on the C-Kermit web page:
http://www.columbia.edu/kermit/ckermit.html#studies
You might prefer to read them there, where you can follow
links conveniently.
For years, people have been asking us how to use C-Kermit as their PPP
dialer in Linux and other kinds of Unix. Until now, there has never been
a good answer. There were some half-good answers, such as those found in
item 27 of the Kermit FAQ. The problem was that any connection opened by
C-Kermit would be closed when it exited, so C-Kermit had to be kept alive
(even though it wasn't doing anything) for the duration of the PPP
connection.
C-Kermit 7.0 includes a new command that handles PPP dialing in a natural
and straightforward way:
EXEC [ /REDIRECT ] <command> [ <arg1> [ <arg2> [ ... ] ]
Runs the given command with the arguments in such a way that the
<command> replaces C-Kermit in memory, and C-Kermit ceases to execute.
EXEC is like RUN, except instead of returning to C-Kermit when finished,
the <command> returns to whatever process invoked Kermit.
In the normal case, no files are closed, so the EXEC'd command inherits
the open files, read/write pointers, working directory, process ID, user
ID (unless <command> is SUID), group ID (unless command is SGID), groups,
etc; in UNIX, the EXEC command is simply a front end for the execvp()
system service.
If the /REDIRECT switch is included, then if a connection is open (SET
LINE or SET HOST), it becomes the standard input and output of the EXEC'd
program. This is how PPP dialing is done.
Here's an example for Linux, in which we dial a traditional terminal
server that issues a login and password prompt (as opposed to, say, using
PAP or CHAP authentication). We assume that the script has already set up
the myuserid and mypassword variables (normally the password should be
prompted for, not stored on disk).
set modem type usr ; Specify the kind of modem you have
set line /dev/ttyS1 ; Specify the device it's connected to
set speed 57600 ; and the speed
set flow rts/cts ; and flow control.
set dial retries 100 ; Try the dial sequence up to 100 times.
dial {{+1(212)555-1212}{+1(212)555-1213}{+1(212)9-555-1214}}
if fail exit 1
for \%i 1 16 1 { ; Try up to 16 times to get login prompt
input 10 Login: ; Wait 10 sec for it to appear
if success break ; Got it - proceed...
output \13 ; Send a carriage return and try again
}
if ( > \%i 16 ) exit 1 NO LOGIN PROMPT
lineout \(myuserid) ; Send user ID
input 30 assword: ; Wait for Password prompt
if fail stop 1 NO PASSWORD PROMPT
lineout \m(mypassword) ; Send the password.
exec /redirect pppd ; Replace ourselves with pppd.
Just before the "exec" command, you might also need to send a command
to the terminal server that tells it to start PPP; some terminal servers
always start PPP, some give you a choice of Telnet, Rlogin, PPP, SLIP,
LAT, and/or other services.
Notice the advantages over the well-known "chat script":
. You don't have to control the modem itself with AT commands; Kermit's
DIAL command does this for you.
. You can have Kermit automatically redial automatically as many times
as you want until it gets a connection (if that is legal in your
country); in this example, three numbers are dialed up to 100 times
each.
. You can have Kermit fetch the number or numbers from a dialing
directory.
. You can have Kermit cycle through a list of phone numbers without
having to enter the numbers in a dialing directory, as shown above.
. Dialing is location-independent; you can use the same script to dial
from different areas or countries.
. Once the connection is made, the full power of Kermit's script
language is available to manage the dialog with the terminal server
or other device that answers the phone call.
The syntax of the DIAL command in the example is new to C-Kermit 7.0 and
explained in Section 2.1.15 of the ckermit2.txt file; it lets you give a
list of numbers to be dialed in case the first one doesn't answer; as
noted, the only way to do this in earlier C-Kermit versions was with a
dialing directory.
The sample script is not universal, but not that hard to generalize by
making it a Kerbang script (called, say, "startppp") that takes phone
numbers, username, and password as command-line arguments and prompts
interactively for any of these that are missing.
- Frank